package cn.jsj.dispose;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * 修改实习律师信息处理类
 * @author LI
 *
 */
public class ModifyPracLawyerInfo extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		 //调试信息
		cn.jsj.utils.SysLogger.PrintInfo("进入修改shixi律师信息处理类");
		
		//获取修改后的信息
		String praclawid=request.getParameter("praclawid").trim();
		String praclawname=request.getParameter("praclawname").trim();
		String birthtime=request.getParameter("birthtime").trim();
		String praclawsex=request.getParameter("praclawsex").trim();
		String politicalstatus=request.getParameter("politicalstatus").trim();
		String educationallevel=request.getParameter("educationallevel").trim();
		String graduateschool=request.getParameter("graduateschool").trim();
		String praclawphone=request.getParameter("praclawphone").trim();
		String starttime=request.getParameter("starttime").trim();
		String endtime=request.getParameter("endtime").trim();
		String pracagreement=request.getParameter("pracagreement").trim();
		int pracagreementN=0;
		if(pracagreement.equals("签订了协议"))
			pracagreementN=1;
		if(pracagreement.length()==1){
			pracagreementN=Integer.parseInt(pracagreement);
		}
			
		String identitynumber=request.getParameter("identitynumber").trim();
		String parclawemail=request.getParameter("parclawemail").trim();
		String practicenumber=request.getParameter("practicenumber").trim();
		String guideteacher=request.getParameter("guideteacher").trim();
		
		//根据实习指导老师姓名得到他的ID
		cn.jsj.dao.TblLawyerDAO tld=new cn.jsj.dao.TblLawyerDAO();
		int teacherId=tld.getLawyerId(guideteacher);
		
		 //调试信息
		cn.jsj.utils.SysLogger.PrintInfo("获得的参数为----->"+praclawid+praclawname+politicalstatus);
		//新建实习律师对象
		cn.jsj.pojo.TblPracticeLawyer modifyPracLawyer=new cn.jsj.pojo.TblPracticeLawyer();
		modifyPracLawyer.setPracLawId(Integer.parseInt(praclawid));
		modifyPracLawyer.setPracLawName(praclawname);
		modifyPracLawyer.setBirthTime(cn.jsj.utils.TimeDispose.transferDate(birthtime));
		modifyPracLawyer.setPracLawSex(praclawsex);
		modifyPracLawyer.setPoliticalStatus(politicalstatus);
		modifyPracLawyer.setEducationalLevel(educationallevel);
		modifyPracLawyer.setGraduateSchool(graduateschool);
		modifyPracLawyer.setPracLawPhone(praclawphone);
		modifyPracLawyer.setStartTime(cn.jsj.utils.TimeDispose.transferDate(starttime));
		modifyPracLawyer.setEndTime(cn.jsj.utils.TimeDispose.transferDate(endtime));
		modifyPracLawyer.setPracAgreement(pracagreementN);
		modifyPracLawyer.setIdentityNumber(identitynumber);
		modifyPracLawyer.setParcLawEmail(parclawemail);
		modifyPracLawyer.setPracticeNumber(practicenumber);
		modifyPracLawyer.setGuidTeacher(teacherId);
		cn.jsj.utils.SysLogger.PrintInfo("赋值完成！！！");
		//更新修改的实习律师对象
		cn.jsj.dao.TblPracticeLawyerDAO tpld=new cn.jsj.dao.TblPracticeLawyerDAO();
		tpld.modifyPracLawyerInfo(modifyPracLawyer);
		
		//调试信息
		cn.jsj.utils.SysLogger.PrintInfo("更改完成！！！");
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request,response);
	}

}
